Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: generate custom elements manifest #9556

Closed
wants to merge 4 commits into from

Conversation

benelan
Copy link
Member

@benelan benelan commented Jun 11, 2024

Summary

Custom Elements Manifest is the community's chosen specification for json-formatted documentation. It is similar to Stencil's docs-json, however there is more community support. The analyzer npm package added builtin support for Stencil projects since the last time I checked!

Example output for calcite-accordion
{
    "kind": "javascript-module",
    "path": "src/components/accordion/accordion.tsx",
    "declarations": [
    {
        "kind": "class",
        "description": "",
        "name": "Accordion",
        "slots": [
        {
            "description": "A slot for adding `calcite-accordion-item`s. `calcite-accordion` cannot be nested, however `calcite-accordion-item`s can.",
            "name": ""
        }
        ],
        "members": [
        {
            "kind": "field",
            "name": "appearance",
            "type": {
            "text": "Extract<\"solid\" | \"transparent\", Appearance>"
            },
            "default": "\"solid\"",
            "description": "Specifies the appearance of the component."
        },
        {
            "kind": "field",
            "name": "iconPosition",
            "type": {
            "text": "Extract<\"start\" | \"end\", Position>"
            },
            "default": "\"end\"",
            "description": "Specifies the placement of the icon in the header."
        },
        {
            "kind": "field",
            "name": "iconType",
            "type": {
            "text": "Extract<\"chevron\" | \"caret\" | \"plus-minus\", IconType>"
            },
            "default": "\"chevron\"",
            "description": "Specifies the type of the icon in the header."
        },
        {
            "kind": "field",
            "name": "scale",
            "type": {
            "text": "Scale"
            },
            "default": "\"m\"",
            "description": "Specifies the size of the component."
        },
        {
            "kind": "field",
            "name": "selectionMode",
            "type": {
            "text": "Extract<\n    \"single\" | \"single-persist\" | \"multiple\",\n    SelectionMode\n  >"
            },
            "default": "\"multiple\"",
            "description": "Specifies the selection mode of the component, where:\n\n`\"multiple\"` allows any number of selections,\n\n`\"single\"` allows only one selection, and\n\n`\"single-persist\"` allows one selection and prevents de-selection."
        },
        {
            "kind": "method",
            "name": "handlePropsChange",
            "return": {
            "type": {
                "text": "void"
            }
            }
        },
        {
            "kind": "method",
            "name": "render",
            "return": {
            "type": {
                "text": "VNode"
            }
            }
        },
        {
            "kind": "method",
            "name": "updateActiveItemOnChange",
            "return": {
            "type": {
                "text": "void"
            }
            },
            "parameters": [
            {
                "name": "event",
                "type": {
                "text": "CustomEvent"
                }
            }
            ]
        },
        {
            "kind": "field",
            "name": "el",
            "type": {
            "text": "HTMLCalciteAccordionElement"
            }
        },
        {
            "kind": "field",
            "name": "mutationObserver"
        },
        {
            "kind": "method",
            "name": "updateAccordionItems",
            "privacy": "private",
            "return": {
            "type": {
                "text": "void"
            }
            }
        }
        ],
        "attributes": [
        {
            "name": "appearance",
            "fieldName": "appearance",
            "type": {
            "text": "Extract<\"solid\" | \"transparent\", Appearance>"
            }
        },
        {
            "name": "icon-position",
            "fieldName": "iconPosition",
            "type": {
            "text": "Extract<\"start\" | \"end\", Position>"
            }
        },
        {
            "name": "icon-type",
            "fieldName": "iconType",
            "type": {
            "text": "Extract<\"chevron\" | \"caret\" | \"plus-minus\", IconType>"
            }
        },
        {
            "name": "scale",
            "fieldName": "scale",
            "type": {
            "text": "Scale"
            }
        },
        {
            "name": "selection-mode",
            "fieldName": "selectionMode",
            "type": {
            "text": "Extract<\n    \"single\" | \"single-persist\" | \"multiple\",\n    SelectionMode\n  >"
            }
        }
        ],
        "tagName": "calcite-accordion",
        "events": [],
        "customElement": true
    }
    ],
    "exports": [
    {
        "kind": "js",
        "name": "Accordion",
        "declaration": {
        "name": "Accordion",
        "module": "src/components/accordion/accordion.tsx"
        }
    },
    {
        "kind": "custom-element-definition",
        "name": "calcite-accordion",
        "declaration": {
        "name": "Accordion",
        "module": "src/components/accordion/accordion.tsx"
        }
    }
    ]
},

Custom Elements Manifest is the community's chosen specification for
json-formatted documentation. It is similar to Stencil's docs-json,
however there is more community support.

package: https://github.com/open-wc/custom-elements-manifest
spec: https://github.com/webcomponents/custom-elements-manifest
@github-actions github-actions bot added the chore Issues with changes that don't modify src or test files. label Jun 11, 2024
@benelan benelan marked this pull request as ready for review June 25, 2024 08:59
Copy link
Contributor

github-actions bot commented Jul 6, 2024

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues or pull requests that have not had recent activity. label Jul 6, 2024
@jcfranco
Copy link
Member

@benelan Is this superseded by #10310?

@benelan
Copy link
Member Author

benelan commented Oct 21, 2024

closing in favor of #10482

@benelan benelan closed this Oct 21, 2024
@jcfranco jcfranco deleted the benelan/generate-custom-elements-manifest branch October 21, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issues with changes that don't modify src or test files. Stale Issues or pull requests that have not had recent activity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants